// 创建场景
let scene = new THREE.Scene();

// 生成材质
let texture = new THREE.TextureLoader().load("./textures/wall.jpg");

// 创建摄像头
let camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(20, 20, 50)
camera.lookAt(0, 0, 0)
let renderer = new THREE.WebGLRenderer();

//生成白色的渲染器
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
renderer.setClearColor(0xffffff)


let geometry = new THREE.BoxGeometry(32, 32, 32);
let material = new THREE.MeshBasicMaterial({ map: texture });
let wall = new THREE.Mesh(geometry, material);
console.log(wall)
scene.add(wall);


// 渲染循环
function render() {
    // 以每秒60次的频率绘制场景
    requestAnimationFrame(render);
    renderer.render(scene, camera);
    wall.rotation.y -= 0.02;
}
render();
